home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 6.0 KB | 183 lines | [TEXT/MPS ] |
- {
- File: DeskBus.p
-
- Contains: Apple Desktop Bus (ADB) Interfaces.
-
- Version: Technology: System 7.5
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- }
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := 0}
- {$ENDC}
-
- {$IFC NOT UsingIncludes}
- UNIT DeskBus;
- INTERFACE
- {$ENDC}
-
- {$IFC UNDEFINED __DESKBUS__}
- {$SETC __DESKBUS__ := 1}
-
- {$I+}
- {$SETC DeskBusIncludes := UsingIncludes}
- {$SETC UsingIncludes := 1}
-
- {$IFC UNDEFINED __TYPES__}
- {$I Types.p}
- {$ENDC}
- {$IFC UNDEFINED __MIXEDMODE__}
- {$I MixedMode.p}
- {$ENDC}
-
- {$PUSH}
- {$ALIGN MAC68K}
- {$LibExport+}
-
- {$IFC FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE }
-
- TYPE
- ADBAddress = SInt8;
- ADBCompletionProcPtr = Register68kProcPtr; { PROCEDURE ADBCompletion(buffer: Ptr; refCon: Ptr; command: LONGINT); }
-
- ADBDeviceDriverProcPtr = Register68kProcPtr; { PROCEDURE ADBDeviceDriver(devAddress: SInt8; devType: SInt8); }
-
- ADBServiceRoutineProcPtr = Register68kProcPtr; { PROCEDURE ADBServiceRoutine(buffer: Ptr; completionProc: ADBServiceRoutineUPP; refCon: Ptr; command: LONGINT); }
-
- ADBInitProcPtr = Register68kProcPtr; { PROCEDURE ADBInit(callOrder: SInt8); }
-
- ADBCompletionUPP = UniversalProcPtr;
- ADBDeviceDriverUPP = UniversalProcPtr;
- ADBServiceRoutineUPP = UniversalProcPtr;
- ADBInitUPP = UniversalProcPtr;
- ADBDataBlockPtr = ^ADBDataBlock;
- ADBDataBlock = PACKED RECORD
- devType: SInt8; { original handler ID }
- origADBAddr: SInt8; { original ADB Address }
- dbServiceRtPtr: ADBServiceRoutineUPP; { service routine pointer }
- dbDataAreaAddr: Ptr; { this field is passed as the refCon parameter to the service routine }
- END;
-
- ADBDBlkPtr = ^ADBDataBlock;
- ADBSetInfoBlockPtr = ^ADBSetInfoBlock;
- ADBSetInfoBlock = RECORD
- siService: ADBServiceRoutineUPP; { service routine pointer }
- siDataAreaAddr: Ptr; { this field is passed as the refCon parameter to the service routine }
- END;
-
- ADBSInfoPtr = ^ADBSetInfoBlock;
- { ADBOpBlock is only used when calling ADBOp from 68k assembly code }
- ADBOpBlockPtr = ^ADBOpBlock;
- ADBOpBlock = RECORD
- dataBuffPtr: Ptr; { buffer: pointer to variable length data buffer }
- opServiceRtPtr: ADBServiceRoutineUPP; { completionProc: completion routine pointer }
- opDataAreaPtr: Ptr; { refCon: this field is passed as the refCon parameter to the completion routine }
- END;
-
- ADBOpBPtr = ^ADBOpBlock;
- PROCEDURE ADBReInit;
- {$IFC NOT GENERATINGCFM}
- INLINE $A07B;
- {$ENDC}
- {
- ADBOp has a different interface for 68k assembly than for everything else
- for 68k assembly the interface is
- #pragma parameter __D0 ADBOp(__A0,__D0)
- OSErr ADBOp( ADBOpBlock * pb, short commandNum );
- }
- {
- IMPORTANT NOTE:
- "Inside Macintosh: Devices" documents the completion routine for ADBOp will be called with
- four parameters using 68k register based calling conventions, specifically the completion routine
- passed in should be of type ADBServiceRoutineProcPtr. However, when upp types were first added
- to this interface file, the type ADBCompletionUPP was mistakenly used for the second parameter
- to ADBOp. Since applications have shipped using completion routines of type ADBCompletionUPP,
- the mistake cannot be corrected.
- The only difference between ADBServiceRoutineUPP and ADBCompletionUPP is the former takes an extra
- argument which is a pointer to itself, fortunately not needed for PowerPC code.
- For compatibility with existing 68k code, when an ADBOp completion routine is called,
- 68k register A1 will point to the completion routine, as documented in Inside Mac.
- }
- FUNCTION ADBOp(refCon: Ptr; compRout: ADBCompletionUPP; buffer: Ptr; commandNum: INTEGER): OSErr;
- FUNCTION CountADBs: INTEGER;
- {$IFC NOT GENERATINGCFM}
- INLINE $A077, $3E80;
- {$ENDC}
- FUNCTION GetIndADB(VAR info: ADBDataBlock; devTableIndex: INTEGER): ADBAddress;
- {$IFC NOT GENERATINGCFM}
- INLINE $301F, $205F, $A078, $1E80;
- {$ENDC}
- FUNCTION GetADBInfo(VAR info: ADBDataBlock; adbAddr: ADBAddress): OSErr;
- {$IFC NOT GENERATINGCFM}
- INLINE $101F, $205F, $A079, $3E80;
- {$ENDC}
- FUNCTION SetADBInfo({CONST}VAR info: ADBSetInfoBlock; adbAddr: ADBAddress): OSErr;
- {$IFC NOT GENERATINGCFM}
- INLINE $101F, $205F, $A07A, $3E80;
- {$ENDC}
-
- CONST
- uppADBCompletionProcInfo = $007B9802;
- uppADBDeviceDriverProcInfo = $00050802;
- uppADBServiceRoutineProcInfo = $0F749802;
- uppADBInitProcInfo = $00000802;
-
- FUNCTION NewADBCompletionProc(userRoutine: ADBCompletionProcPtr): ADBCompletionUPP;
- {$IFC NOT GENERATINGCFM }
- INLINE $2E9F;
- {$ENDC}
-
- FUNCTION NewADBDeviceDriverProc(userRoutine: ADBDeviceDriverProcPtr): ADBDeviceDriverUPP;
- {$IFC NOT GENERATINGCFM }
- INLINE $2E9F;
- {$ENDC}
-
- FUNCTION NewADBServiceRoutineProc(userRoutine: ADBServiceRoutineProcPtr): ADBServiceRoutineUPP;
- {$IFC NOT GENERATINGCFM }
- INLINE $2E9F;
- {$ENDC}
-
- FUNCTION NewADBInitProc(userRoutine: ADBInitProcPtr): ADBInitUPP;
- {$IFC NOT GENERATINGCFM }
- INLINE $2E9F;
- {$ENDC}
-
- PROCEDURE CallADBCompletionProc(buffer: Ptr; refCon: Ptr; command: LONGINT; userRoutine: ADBCompletionUPP);
- {$IFC NOT GENERATINGCFM}
- {To be implemented: Glue to move parameters into registers.}
- {$ENDC}
-
- PROCEDURE CallADBDeviceDriverProc(devAddress: SInt8; devType: SInt8; userRoutine: ADBDeviceDriverUPP);
- {$IFC NOT GENERATINGCFM}
- {To be implemented: Glue to move parameters into registers.}
- {$ENDC}
-
- PROCEDURE CallADBServiceRoutineProc(buffer: Ptr; completionProc: ADBServiceRoutineUPP; refCon: Ptr; command: LONGINT; userRoutine: ADBServiceRoutineUPP);
- {$IFC NOT GENERATINGCFM}
- {To be implemented: Glue to move parameters into registers.}
- {$ENDC}
-
- PROCEDURE CallADBInitProc(callOrder: SInt8; userRoutine: ADBInitUPP);
- {$IFC NOT GENERATINGCFM}
- {To be implemented: Glue to move parameters into registers.}
- {$ENDC}
- {$ENDC}
- {$ALIGN RESET}
- {$POP}
-
- {$SETC UsingIncludes := DeskBusIncludes}
-
- {$ENDC} {__DESKBUS__}
-
- {$IFC NOT UsingIncludes}
- END.
- {$ENDC}
-